<template>
	<view>

		上传图片

		<!-- #ifdef H5 -->

		<button type="primary" size="default" @click="uploadimg">H5 上传图片</button>
		<!-- #endif -->

		<!-- #ifdef MP-WEIXIN -->
		<button type="primary" size="default" @click="uploadimg">WEIXIN 上传图片</button>

		<!-- #endif -->



		<image v-for="(item, index) in imgArr" :key="index" :src="item" @click="previemimg"> </image>

 
 <testa></testa>
	<testb></testb>
	</view>
</template>

<script>
	import testa from "../../components/a.vue"
	import testb from "../../components/b.vue"
	
	export default {
components:{
	"testa":testa,
	"testb":testb
},
		data() {
			return {
				imgArr: []
			}
		},
		onLoad() {
			// #ifdef H5 
			console.info("H5 页面被加载了")
			// #endif  
			// #ifdef MP-WEIXIN 
			console.info(" MP-WEIXIN 页面被加载了")
			// #endif 
		},
		methods: {

			previemimg(cnt) {
				uni.previewImage({
					urls: this.imgArr,
					cnt
				})
			},
			uploadimg() {
				console.info("上传图片")
				uni.chooseImage({
					count: 9,
					success: res => {
						this.imgArr = res.tempFilePaths
						console.info(this.imgArr)
					}
				})

			}
		}
	}
</script>

<style>
</style>
